<template>
	<view style="background-color: ;height: ">
		<!-- 导航栏 -->
		<view>
			<uni-nav-bar title="订单编号" :border="true" :fixed="true" background-color="rgba(0, 0, 0, 0)"
				:statusBar="true">
			</uni-nav-bar>
		</view>
		<view style="background-color: ;">
			<view style="transform: scale(0.95);">
				<view>
					<text style="color: #474F65;font-weight: 800;">订单编号 {{workDetail.order_id}}</text>
				</view>
				<view style="margin-top: 10px;">
					<text style="color: #474F65;font-weight: 800;">任务名称 {{workDetail.title}}</text>
				</view>
				<view style="display: flex;justify-content: space-between;margin-top: 15px;">
					<text style="color: #B1B4B8;font-size: 14px;">奖励方式</text>
					<text style="color: red;"><text style="font-size: 28px;font-weight: 700;">{{workDetail.money}}
						</text>呜噜币</text>
				</view>
				<u-line :hairline="false" style="margin-top: 20px;transform: ;"></u-line>
				<!-- 任务时间 -->
				<view style="margin-top: 10px;">
					<text style="color: #B1B4B8;">开始时间&nbsp;&nbsp;&nbsp;&nbsp;{{workDetail.data_statr}}</text>
				</view>
				<view style="margin-top: 10px;">
					<text style="color: #B1B4B8;">结束时间&nbsp;&nbsp;&nbsp;&nbsp;{{workDetail.data_end}}</text>
				</view>
				<u-line :hairline="false" style="margin-top: 20px;transform: ;"></u-line>
				<!-- 任务详情 -->
				<view>
					<text style="font-weight: 800;">任务详情</text>
					<view style="margin-top: 20px;">
						<text style="line-height: 30px;color: #B1B4B8;">
							{{workDetail.content}}
						</text>
					</view>
				</view>
				<view style="height: ;" v-for="(item, index) in taskList" :key="index">
					<up-image :show-loading="true" :src="item" width="100px" height="100px"></up-image>
				</view>
				<view style="color: #B1B4B8;margin-top: 50px;">
					<u-rate active-color="#FA3534" inactive-color="#b2b2b2" v-model="rateValue" size="30" gutter="20"
						allowHalf="true"></u-rate>
				</view>
			</view>
		</view>
		<u-tabbar :value="value1" @change="change1" :fixed="true" :placeholder="false" :safeAreaInsetBottom="false"
			style="display: flex; justify-content: flex-start;">
			<u-tabbar-item @click="click1">
				<template #text>
					<view style="width: 150px;"><u-button text="驳回审核" color="#FE4D53" shape="circle"
							@click="subTask"></u-button></view>
				</template>
			</u-tabbar-item>
			<u-tabbar-item>
				<template #text>
					<view style="width: 150px;"><u-button text="审核通过" color="#FE4D53" shape="circle"
							@click="subTask"></u-button></view>
				</template>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	import {
		finishWork
	} from "../../request/API/finishWork.js";
	import {
		workDetail
	} from "../../request/API/workDetail.js";
	import {
		getVerifyList
	} from "../../request/API/getVerifyList.js";
	import {
		checkTask
	} from "../../request/API/checkTask.js";
	export default {
		data() {
			return {
				fileList1: [],
				tempfile: [],
				workDetail: [],
				rateValue: 1,
				taskList: null,
				order_id: '',
				work_id: '',
				taskListId: null
			}
		},
		onLoad(options) {
			this.order_id = options.order_id;
			this.work_id = options.id;
			const work_id = this.work_id
			console.log(work_id)
			const order_id = this.order_id
			workDetail({
					work_id
				})
				.then(data => {
					this.workDetail = data.data
					console.log(data)
				})
				.catch(Error => {

				})
			getVerifyList()
				.then(data => {
					console.log(data.data[0].image)
					// const imageUrlString = data.data[0].image.join("");
					console.log(123);
					this.taskList = data.data[0].image
					this.taskListId = data.data[0]

				})
				.catch(Error => {

				})
			console.log(this.order_id)
		},
		methods: {
			subTask() {
				const task_id = this.taskListId.id
				const rateValue = this.rateValue
				const value = this.workDetail.money
				console.log(value)
				checkTask({
						task_id,
						rateValue,
						value
					})
					.then(data => {
						uni.redirectTo({
							url: '/pages/task/pending' // 重定向到首页，刷新页面
						});
						uni.showToast({
							title: data.msg,
							icon: 'none',
						});

					})
					.catch(Error => {
						uni.showToast({
							title: Error.msg,
							icon: 'none',
						});
					})
			}
		}
	}
</script>

<style>
</style>